package com.imooc.oo

object SimpleObjectApp {

  def main(args: Array[String]): Unit = {

    val person = new People()
    person.name = "Messi"

    println(person.name + " ... " + person.age )

    println("invoke eat method: " + person.eat)

    person.watchFootball("Barcelona")

    person.printInfo()

  }
}

class People{

  var name:String = _
  val age = 10

  //当被private [this] 修饰的变量 只能在类 内部 进行访问
  private [this] val gender = "male"

  def printInfo(): Unit ={
    println("gender: " + gender)
  }


  def eat() = name + " eating .... "

  def watchFootball(teamName : String): Unit = {
    println(name + "is watching match of " + teamName)
  }
}
